|
|
|
|
|
|
|
Unless you've been in a closet for the last several years, you should know that almost every Windows application available has oneif not moretoolbars to enhance the user interface. Toolbars provide users with a quick way to get at the application's commonly used functions. Depending on the application, one or more toolbars could help with specific tasks, such as the Editor Toolbar in the Visual Basic IDE. Because toolbars are so widely used, most users now expect any application they use to have them. |
|
|
|
|
|
|
|
|
Adding toolbars to your application has become fairly easy with the Toolbar control supplied with Visual Basic. Creating a simple or complicated toolbar requires that you add the following controls to the form: |
|
|
|
|
|
|
|
|
The Toolbar control sets up the buttons of the actual toolbar displayed to users and handles user requests. |
|
|
|
|
|
|
|
|
CH:149> The ImageList control contains the bitmaps used on the toolbar buttons. |
|
|
|
|
|
|
|
|
To see how to set up a toolbar for your application, start a new project and name it TOOLBAR. To be able to add the toolbar to your forms, you need to have the controls in your Visual Basic toolbox. Because both controls are included in the Windows Common Controls 6.0 Custom controls, you simply add the one OCX file to your project. |
|
|
|
|
|
|
|
|
Adding a Toolbar the Old-Fashioned Way |
|
|
|
|
|
|
|
|
This section shows you how to use the Toolbar control with the ImageList control. Even though the toolbar now has a wizard associated with it to make it easy to setup the toolbar, it is a good idea to see how to set it up manually. |
|
|
|
|
|
|
|
|
Note The toolbar wizard is only displayed when you add the control to a form. |
|
|
|
|
|
|
|
|
|
Selecting the Images for the Buttons |
|
|
|
|
|
|
|
|
To create a toolbar, you first need to place an ImageList control on your form. To begin the process, add the bitmaps in the ImageList control's Property Pages dialog box (right-click the control and select Properties from the pop-up menu). The Images page is where you add the bitmaps (see Figure 4.1). |
|
|
|
|
|
|
|
|
To add an image to the ImageList control, click the Insert Picture button. In the Image File Open dialog box that appears, you can choose the bitmap or icon that you want to |
|
|
|
|
|